<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.qijia.travel.app.*"  %>
<%@ page import="com.qijia.travel.domain.*"  %>
<%@ page import="com.qijia.travel.common.*"  %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

GuideManager manager = new GuideManager();
Guide guide = (Guide)session.getAttribute(Constants.USER_KEY);
GuideAccount account = manager.getAccountInfo(guide.getGuideId());
if(account==null)out.println("<script>alert('你不存在登录账号，请联系管理员为你创建一个登录账号!!');window.location='"+basePath+"';</script>");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<title>后台管理平台--旅游网</title>
<link rel="stylesheet" type="text/css" href="../css/layout.css" />
</head>

<body>
<div id="wrapper">
    <!--头部菜单开始-->
    <jsp:include page="../common/TopMenu.jsp"></jsp:include>
    <!--头部菜单结束-->
	<div id="BreadCrumb">我的位置：基本资料管理 &gt; 修改密码</div>
	<div id="REC_content">
	    <fieldset id="BasicInfo" class="mainField">
		    <legend><span class="title">修改密码</span></legend>
			<div class="innerCon">
			    <!-- begin tab -->
			    <div class="topControl clearfix">
				    <div id="BasicInfoTabCon" class="itemTabCon">
					    <ul id="BasicInfoTabs" class="itemTabs">
					        <li id="dueTab" class="blur"><a href="<%=basePath%>baseInfo/ModifyInfo.jsp">修改个人信息</a></li>
						    <li id="onlineTab" class="focus"><a href="<%=basePath%>baseInfo/ModifyPwd.jsp" onfocus="this.blur()">修改密码</a></li>
					    </ul>
				    </div>
			    </div>
			    <!-- end tab -->
				<div id="mainListCon">
				    <form action="" method="post">
				    <div id="mLC">
					    <ul>
						    <li><span>登录用户名：</span><%=account.getAccountName()==null?"":account.getAccountName()%></li>
							<li><span>输入旧密码：</span><input id="oldPwd" name="oldPwd" type="password" class="text middle" /></li>
							<li><span>输入新密码：</span><input id="pwd" name="pwd" type="password" class="text middle" /> 提示：请输入6-20位非规律字母或数字，且不能与用户名称相同。不填则不修改密码</li>
							<li><span>确认新密码：</span><input id="conPwd" name="conPwd" type="password" class="text middle" /></li>
							<li><span></span><input name="" onclick="updatePwd()" type="button" class="btn_submit" value="确定" /> <input name="" type="reset" class="btn_submit" value="重填" /></li>
						</ul>
					</div>
				    </form>
				</div>
			</div>
		</fieldset>
	</div>
	<jsp:include page="../common/Foot.jsp"></jsp:include>
</div>
<script src="<%=basePath%>dwr/interface/guideManager.js"></script>
<script src="<%=basePath%>dwr/engine.js"></script>
<script src="<%=basePath%>js/jquery.js"></script>
<script>
function updatePwd(){
  if($.trim($("#pwd").val())!=$.trim($("#conPwd").val())){
    alert("确认密码与密码不相同!");
    return;
 }else if($.trim($("#pwd").val())=='<%=account.getAccountName()%>'){
    alert("密码不能与用户名相同!");
    return;
 }else{
   guideManager.updatePwd($.trim($("#oldPwd").val()),$.trim($("#pwd").val()),function(data){alert("修改成功!");window.location.reload();});
 }
}
</script>
</body>
</html>
